<template>
  <div>
      <shopItem :sidebarList='list' :foodList="food" :address="address" />
  </div>
</template>

<script>
import shopItem from '@/components/shop-item'
import {  getFoodShopList, getFoodClassfiy, getFood, getAddress } from '@/api/shop'
export default {
    components: {
        shopItem
    },
    data () {
        return {
            list: [],
            food: [],
            address: {}
        }
    },
    created() {
        this.getFoodClassfiy()
    },
    methods: {
        async getFoodClassfiy() {
           const { data } = await getFoodClassfiy()
           const result = await getFood({restaurant_id:this.$route.params.id})
           this.food = [...data, ...result.data]
          try{
              const { data: { category_list } } = await getFoodShopList(this.$route.params.id)
              category_list.splice(7)
              this.list = category_list
              console.log(category_list);
          }catch(err){
              console.log(err);
          }
          console.log()
          const add = await getAddress(this.$route.params.id)
          this.address = add.data
          console.log(this.address);
        }
    }
}
</script>

<style>

</style>